<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common :: header"/>
<body style="background-color: #fff">
<style>
    .dm-form{padding-top: 20px; padding-left: 60px;}
    .dm-form tr{height: 50px;}
    .dm-form input{width: 260px}
    .dm-label{width: 80px;padding-right: 15px;text-align: right}
</style>
<form id="form_edit" class="dm-form" method="post" action='/system/user/edit'>
    <input type="hidden" name="userId" th:value="${user.userId}">
    <table>
        <tr>
            <td class="dm-label">帐号</td>
            <td class="dm-content">
                <input class="easyui-textbox" name="loginName" readonly th:value="${user.loginName}">
            </td>
        </tr>
        <tr>
            <td class="dm-label">姓名</td>
            <td class="dm-content">
                <input class="easyui-textbox" name="userName" data-options="required:true" th:value="${user.userName}">
            </td>
        </tr>
        <tr id="tr_icon">
            <td class="dm-label">手机</td>
            <td class="dm-content">
                <input class="easyui-textbox" name="phone" validType="mobile" th:value="${user.phone}" data-options="required:true">
            </td>
        </tr>
        <tr>
            <td class="dm-label">角色</td>
            <td class="dm-content">
                <input id="user_roleIds" name="roleIds" th:value="${roleIds}">
            </td>
        </tr>
        <tr>
            <td class="dm-label">部门</td>
            <td class="dm-content">
                <input id="user_deptId" name="deptId" th:value="${user.deptId}">
            </td>
        </tr>
        <tr>
            <td class="dm-label">姓别</td>
            <td class="dm-content">
                <input class="sex" name="sex" data-options="label:'男'" value="1">
                <input class="sex" name="sex" data-options="label:'女'" value="2">
            </td>
        </tr>
        <tr>
            <td class="dm-label">状态</td>
            <td class="dm-content">
                <input class="status" name="status" data-options="label:'正常'" value="0">
                <input class="status" name="status" data-options="label:'停用'" value="1">
            </td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    $(function() {
        $('.sex').radiobox({})
        $('.status').radiobox({})

        $('.sex').radiobox('checked',[[${user.sex}]]);
        $('.status').radiobox('checked', [[${user.status}]]);

        $('#user_roleIds').combobox({
            url: '/system/role/getRoles',
            valueField: 'roleId',
            textField: 'roleName',
            multiple: true,
            required: true,
            editable: false
        });

        $('#user_deptId').combotree({
            url: '/system/dept/tree',
            cascadeCheck: false,
            editable: false,
            required: true,
            panelHeight: 240
        });
    });

    function submitHandler(index) {
        dm.save('form_edit', function() {
            parent.layer.close(index);
            parent.dm.search('table', 'search_form');
        })
    }
</script>
</body>
</html>

